package com.hfzy.ihk.facade.calldata.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hfzy.ihk.common.facade.BaseEntity;
import com.hfzy.ihk.facade.calldata.enums.CallTextType;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.List;

/**
 * 通话内容(一句一条记录)
 *
 * @author wws
 */
@Document(indexName = "#{elasticSearchConfig.indexName()}_call_history_text",shards = 24,replicas = 2, type = "data")
public class CallHistoryText implements BaseEntity {

    @Id
    private String id;

    private long version;

    /**属于哪一通电话*/
    @Field(type = FieldType.Keyword)
    private String sessionId;

    /**冗余任务包ID*/
    @Field(type = FieldType.Keyword)
    private String callTaskId;

    /**谁说的话*/
    private CallTextType textType;

    /**
     * 通话单句内容
     * */
    @Field(type = FieldType.Text)
    private String context;

    /**是否属于提问:
     * true:表示此句属于客户在提问
     * false：表示客户在回答
     * */
    private boolean askQuestion;

    /** context的分词情况*/
    private List<String> worlds;

    /**分析得出的关键词*/
    private List<String> keyworlds;

    /**
     * 此句话的意图
     * */
    @Field(type = FieldType.Text)
    private String intention;

    /**当前所在步骤ID*/
    @Field(type = FieldType.Keyword)
    private String currentFlowStepId;

    /**推荐话术(实际走的主动流程步骤)*/
    @Field(type = FieldType.Keyword)
    private String nextFlowStepId;

    //-----------------匹配知识库时--------------------
    /**推荐话术(单句问答模式下)
     * */
    @Field(type = FieldType.Text)
    private String knowledgeBaseId;


    /**进入多轮会话流程*/
    @Field(type = FieldType.Text)
    private String mutiSessionFlowId;
    //-----------------匹配知识库时--------------------

    /**推荐话术是否有用*/
    private boolean recommendIsUseful;

    @Field(type = FieldType.Text)
    private String recommendText;

    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss" )
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**“COMMON”表示公共知识，“PRIVATE”表示项目私有知识*/
    @Field(type = FieldType.Keyword)
    private String affectType;

    /**“hangup”表示挂机，还有其他值等。。*/
    @Field(type = FieldType.Keyword)
    private String action;

    @Override
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public long getVersion() {
        return version;
    }

    public void setVersion(long version) {
        this.version = version;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public String getCallTaskId() {
        return callTaskId;
    }

    public void setCallTaskId(String callTaskId) {
        this.callTaskId = callTaskId;
    }

    public CallTextType getTextType() {
        return textType;
    }

    public void setTextType(CallTextType textType) {
        this.textType = textType;
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public boolean isAskQuestion() {
        return askQuestion;
    }

    public void setAskQuestion(boolean askQuestion) {
        this.askQuestion = askQuestion;
    }

    public List<String> getWorlds() {
        return worlds;
    }

    public void setWorlds(List<String> worlds) {
        this.worlds = worlds;
    }

    public List<String> getKeyworlds() {
        return keyworlds;
    }

    public void setKeyworlds(List<String> keyworlds) {
        this.keyworlds = keyworlds;
    }

    public String getIntention() {
        return intention;
    }

    public void setIntention(String intention) {
        this.intention = intention;
    }

    public String getKnowledgeBaseId() {
        return knowledgeBaseId;
    }

    public void setKnowledgeBaseId(String knowledgeBaseId) {
        this.knowledgeBaseId = knowledgeBaseId;
    }

    public String getMutiSessionFlowId() {
        return mutiSessionFlowId;
    }

    public void setMutiSessionFlowId(String mutiSessionFlowId) {
        this.mutiSessionFlowId = mutiSessionFlowId;
    }

    public boolean isRecommendIsUseful() {
        return recommendIsUseful;
    }

    public void setRecommendIsUseful(boolean recommendIsUseful) {
        this.recommendIsUseful = recommendIsUseful;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getCurrentFlowStepId() {
        return currentFlowStepId;
    }

    public void setCurrentFlowStepId(String currentFlowStepId) {
        this.currentFlowStepId = currentFlowStepId;
    }

    public String getNextFlowStepId() {
        return nextFlowStepId;
    }

    public void setNextFlowStepId(String nextFlowStepId) {
        this.nextFlowStepId = nextFlowStepId;
    }

    public String getRecommendText() {
        return recommendText;
    }

    public void setRecommendText(String recommendText) {
        this.recommendText = recommendText;
    }

    public String getAffectType() {
        return affectType;
    }

    public void setAffectType(String affectType) {
        this.affectType = affectType;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }
}
